package cz.uhk.max.beans;
import javax.faces.context.FacesContext;

import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.jsf.FacesContextUtils;

import cz.uhk.max.locator.ServiceLocator;
import cz.uhk.max.service.IEquationService;
import cz.uhk.max.service.IXLSService;

/**
 * @author Pavel Krbálek
 * @version 1.0
 * @created 21-I-2008 16:05:16
 */
public class ServiceLocatorBean implements ServiceLocator {

	private IEquationService equationService;
	private IXLSService xlsService;
	
	public ServiceLocatorBean() {
		setEquationService((IEquationService) getContext().getBean("equationService"));
		xlsService = (IXLSService) getContext().getBean("xlsService");
	}

	private WebApplicationContext getContext() {
		return FacesContextUtils.getWebApplicationContext(
				FacesContext.getCurrentInstance()); 
	}

	public IEquationService getEquationService() {
		return equationService;
	}

	public void setEquationService(IEquationService equationService) {
		this.equationService = equationService;
	}

	public IXLSService getXlsService() {
		return xlsService;
	}

	public void setXlsService(IXLSService xlsService) {
		this.xlsService = xlsService;
	}

	
	
	
}
